﻿using System;
using System.Collections.Generic;
using System.Text;
using Manager.App_Code.IDAL;
using Manager.App_Code.DTO;

namespace Manager.App_Code.DAL
{
    class GhiChuTinhTrangDAL:StandardConnectDB,IGhiChuTinhTrang
    {

        public List<DTO.GhiChuTinhTrangDTO> GetListGhiChuTinhTrangPhong()
        {
            throw new NotImplementedException();
        }

        public DTO.GhiChuTinhTrangDTO GetGhiChuTinhTrangPhongByID(string MaPhong, DateTime TuNgay)
        {

            throw new NotImplementedException();
        }

        public bool InsertGhiChuTinhTrangPhong(DTO.GhiChuTinhTrangDTO ghichutinhtrang)
        {
            throw new NotImplementedException();
        }

        public bool DeleteGhiChuTinhTrangPhong(DTO.GhiChuTinhTrangDTO ghichutinhtrang)
        {
            throw new NotImplementedException();
        }

        public bool UpdateGhiChuTinhTrangPhong(DTO.GhiChuTinhTrangDTO ghichutinhtrang)
        {
            throw new NotImplementedException();
        }

        public DTO.GhiChuTinhTrangDTO ConvertOjectDataRowToGhiChuTinhTrangPhongDTO(System.Data.DataRow dr)
        {
            if (dr != null)
            {
                GhiChuTinhTrangDTO ghichuTT = new GhiChuTinhTrangDTO();

                IPhong iphong = new PhongDAL();
                ghichuTT.MaPhong = iphong.GetPhongByID(dr["MaPhong"].ToString());

                ITinhTrangPhong itinhtrang = new TinhTrangPhongDAL();
                ghichuTT.MaTinhTrang = itinhtrang.GetTinhTrangPhongByID(dr["MaTinhTrang"].ToString());

                ghichuTT.TuNgay = DateTime.Parse(dr["TuNgay"].ToString());

                if (dr["DenNgay"].ToString() != "")
                    ghichuTT.DenNgay = DateTime.Parse(dr["DenNgay"].ToString());

                ghichuTT.GhiChu = dr["GhiChu"].ToString();

                return ghichuTT;
            }
            else
                return null;
        }
    }
}
